The embodiments described herein relate to data compression. More specifically, the embodiments relate to compressing data for optimizing random file access.
File systems organize data into files, with each file representative of a number of blocks of a size, and each block representative of a continuous set of bytes. In compression enabled file systems file compression is performed on “raw” file data to create “compressed” file data. File compression is performed to reduce the number of blocks required to store data of the file. For larger files, it may be desirable to compress a grouping of data blocks, rather than the entire file at once.
Different data files are known to have different compression rates. With a fixed size compression group size, some compression groups may have all of their blocks full with the compressed data utilizing the entirety of the allotted storage space, while other compression groups may have blocks that are only partially filled with compressed data, resulting in compression loss. At the same time, different compression ratios may result in at least a portion of a final compressed data block remaining unused. This unused portion, which is referred to as “internal fragmentation,” results in wasted unused space in each compression group.